/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.h
  * @brief          : Header for main.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
  * All rights reserved.</center></h2>
  *
  * This software component is licensed by ST under BSD 3-Clause license,
  * the "License"; You may not use this file except in compliance with the
  * License. You may obtain a copy of the License at:
  *                        opensource.org/licenses/BSD-3-Clause
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "stdio.h"
#include "math.h"
#include "stm32f4xx_hal_hwconf.h"
#include "HMC5883L_stm32f4xx_hal.h"
#include "ESP12F_stm32f4xx_hal.h"
#include "BEEP_stm32f4xx_hal.h"
/* USER CODE END Includes */

void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);

/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);

/* USER CODE BEGIN EFP */\
void HAL_TIM2_Callback(void);
void HAL_TIM4_Callback(void);
void HAL_TIM5_Callback(void);
void HAL_TIM9_Callback(void);

uint16_t HAL_GetKeyStatus(void);

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/
#define ESP_IO16_Pin GPIO_PIN_0
#define ESP_IO16_GPIO_Port GPIOA
#define ESP_IO14_Pin GPIO_PIN_1
#define ESP_IO14_GPIO_Port GPIOA
#define KEY1_Pin GPIO_PIN_4
#define KEY1_GPIO_Port GPIOC
#define KEY1_EXTI_IRQn EXTI4_IRQn
#define KEY2_Pin GPIO_PIN_5
#define KEY2_GPIO_Port GPIOC
#define KEY2_EXTI_IRQn EXTI9_5_IRQn
#define LED_PA8_Pin GPIO_PIN_8
#define LED_PA8_GPIO_Port GPIOA
#define SM6_Pin GPIO_PIN_15
#define SM6_GPIO_Port GPIOA
#define SM5_Pin GPIO_PIN_10
#define SM5_GPIO_Port GPIOC
#define SM4_Pin GPIO_PIN_11
#define SM4_GPIO_Port GPIOC
#define SM3_Pin GPIO_PIN_12
#define SM3_GPIO_Port GPIOC
#define SM2_Pin GPIO_PIN_2
#define SM2_GPIO_Port GPIOD
#define SM1_Pin GPIO_PIN_3
#define SM1_GPIO_Port GPIOB

#define FUNMODE 0

/* USER CODE BEGIN Private defines */

typedef struct
{
	uint32_t Pressing_Interval;
	uint32_t Release_Interval;
}Key_StatusTypeDef;

typedef enum
{
	KEYF1_PRESSED=0x0001u,
	KEYF1_LONGPRESSED=0x0002u,
	KEYF1_DOUBLEPRESSED=0x0004u,
	KEYF2_PRESSED=0x0008u,
	KEYF2_LONGPRESSED=0x0010u,
	KEYF2_DOUBLEPRESSED=0x0020u,
}Key_CodeTypeDef;

/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
